package fr.upmc.cie.xml;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import fr.upmc.cie.data.interfaces.FeedParser;

public abstract class BaseFeedParser implements FeedParser {

    // names of the XML tags
    static final  String PUB_DATE = "pubDate";
    static final  String DESCRIPTION = "description";
    static final  String LINK = "link";
    static final  String TITLE = "title";
    static final  String ITEM = "item";
    
    final URL feedUrl;

    protected BaseFeedParser(String feedUrl) throws MalformedURLException{
       this.feedUrl = new URL(feedUrl);
    }

    protected InputStream getInputStream() throws IOException {
    	URLConnection connection = feedUrl.openConnection();
    	connection.setConnectTimeout(4000);
        return connection.getInputStream();
    }
}